<template>
	<view>
		<view class="noCollection" v-if="list == ''">
			您还没有收藏哦~
		</view>
		<view style="padding-bottom: 50rpx;">
			<view class="recommendList" v-for="(item,index) in list" @click="MyCollecClick(item.url)">
				<view class="lendingNum">
					<image :src="item.image" mode=""></image>
					<view class="lendingBrand">{{item.name}}</view>
					<view class="lendingPrice">{{item.quota}}</view>
					<view class="lendingQuota">平均额度（元）</view>
				</view>
				<view class="lendingInfor">
					<view>{{item.info[0]}}</view>
					<view>{{item.info[1]}}</view>
					<view>{{item.info[2]}}</view>
				</view>
			</view>
		</view>
		<view class="recommendForyou">
			为您推荐
		</view>
		<view class="recommendList" v-for="(item,index) in Productlist" @click="MyCollecClick(item.url)">
			<view class="lendingNum">
				<image :src="item.image" mode=""></image>
				<view class="lendingBrand">{{item.name}}</view>
				<view class="lendingPrice">20000</view>
				<view class="lendingQuota">平均额度（元）</view>
			</view>
			<view class="lendingInfor">
				<view>{{item.info[0]}}</view>
				<view>{{item.info[1]}}</view>
				<view>{{item.info[2]}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {VUE_API_URL} from "@/components/pulugins/index"
	export default {
		data() {
			return {
				list:'',
				Productlist:'',
			}
		},
		onShow() {
			this.MyCollection();
			this.recommendForyou();
		},
		methods: {
			MyCollection(){
				var that = this;
				uni.request({
				    url: VUE_API_URL + 'collection/list', 
					method:'POST',
				    data: {}, 
				    header: {
				        'Authori-zation': 'Bearer ' + uni.getStorageSync('token') //自定义请求头信息
				    },
				    success: (res) => {
						var data = res.data.data
						console.log(data)
						that.list = data.list;
				    }
				});
			},
			MyCollecClick(url){
				window.location.href=url;
			},
			recommendForyou(){
				var that = this;
				uni.request({
				    url: VUE_API_URL + 'product/recommend', 
					method:'POST',
				    data: {}, 
				    header: {
				        'Authori-zation': 'Bearer ' + uni.getStorageSync('token') //自定义请求头信息
				    },
				    success: (res) => {
						var data = res.data.data
						console.log(data)
						that.Productlist = data.list;
				    }
				});
			},
		}
	}
</script>
<style>
	page{
		background: #F8F8F8;
	}
	.noCollection{
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #888888;
		line-height: 23rpx;
		padding: 364rpx 0 83rpx 0;
		text-align: center;
		box-sizing: border-box;
	}
	.recommendForyou{
		height: 93rpx;
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #000000;
		line-height: 93rpx;
		border-top: 2rpx solid #E4E4E4;
		padding-left: 47rpx;
	}
	.recommendList{
		height: 156rpx;
		border-top: 2rpx solid #E4E4E4;
		padding: 30rpx 0 30rpx 50rpx;
	}
	.lendingNum{
		display: inline-block;
		font-family: PingFang SC;
		width: 200rpx;
	}
	.lendingNum image{
		width: 24rpx;
		height: 27rpx;
	}
	.lendingInfor{
		display: inline-block;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 300;
		color: #000000;
		line-height: 50rpx;
		margin-left: 40rpx;
	}
	.lendingBrand{
		font-size: 28rpx;
		font-weight: bold;
		color: #000000;
		line-height: 23rpx;
		margin-left: 20rpx;
		display: inline-block;
	}
	.lendingPrice{
		font-size: 60rpx;
		font-weight: bold;
		color: #DFAF7F;
		line-height: 100rpx;
	}
	.lendingQuota{
		font-size: 26rpx;
		font-weight: 300;
		color: #000000;
		line-height: 23rpx;
	}

</style>
